<?php
// Where the file is going to be placed
$target_path = '../../images/';
 
/* Add the original filename to our target path. 
Result is "../../images/filename.extension" */
//print_r($_FILES);
$target_path = $target_path . basename( $_FILES['fileField']['name']);

//echo $target_path;

$db_host = 'localhost';
$db_user = 'function';
$db_pwd = 'w9ak4X1l0Y';

$database = 'function_a5110060';
$table = 'File_Manager';

$con = mysql_connect($db_host, $db_user, $db_pwd);
if (!$con)
die("Can't connect to database");
mysql_select_db($database,$con);

$sql="INSERT INTO {$table} (file_name,file_path) VALUES ('".$_FILES['fileField']['name']."','".$target_path."')";
//echo("Sql :".$sql);
$result=mysql_query($sql);
 
if(move_uploaded_file($_FILES['fileField']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['fileField']['name']).
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
?> 